home *** CD-ROM | disk | FTP | other *** search
/ Delphi 5 for Professionals / DELPHI5.iso / AddOns / Components / TEECHART / Src Code / EDITPRO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-10-24  |  2.0 KB  |  79 lines

  1. {$I teedefs.inc}
  2. unit EditPro;
  3.  
  4. interface
  5.  
  6. Uses WinTypes,WinProcs,Controls,Chart,Teengine;
  7.  
  8. { Show the user the dialog associated to the Series }
  9. Procedure EditOneSeries(AOwner:TControl; ASeries:TChartSeries);
  10.  
  11. { Show the user a "Save to..." dialog to save it to disk. }
  12. Function SaveChartDialog(AChart:TCustomChart):String;
  13.  
  14.  
  15. implementation
  16.  
  17. { This unit should be "used" by your applications if showing the
  18.   Chart Editor with "Extended" Series and Functions. }
  19. uses StatChar,CandlEdi,TeeVolEd,SurfEdit,PolarEdi,ErrBarEd,CurvFitt,ContEdit,
  20.      Classes,Forms,SysUtils,TeeConst,TeeProco,Dialogs,TeeStore,TeeBezie,
  21.      Po3DEdit,TeeCount,TeeCumu,EditChar;
  22.  
  23. {$IFDEF D1}
  24. {$R TeeProBM.R16}
  25. {$ELSE}
  26. {$R TeeProBM.RES}
  27. {$ENDIF}
  28.  
  29. { This method shows the "Save As..." dialog to save a Chart }
  30. Function SaveChartDialog(AChart:TCustomChart):String;
  31. begin
  32.   result:='';
  33.   With TSaveDialog.Create(nil) do
  34.   try
  35.     Filter:=TeeMsg_TeeFiles+
  36.           ' (*.' +
  37.           TeeMsg_TeeExtension +
  38.           ')|*.' +
  39.           TeeMsg_TeeExtension;
  40.     Options:=[ofHideReadOnly,ofOverwritePrompt];
  41.     DefaultExt:=TeeMsg_TeeExtension;
  42.     if Execute then
  43.     begin
  44.       SaveChartToFile(AChart,FileName);
  45.       result:=FileName;
  46.     end;
  47.   finally
  48.     Free;
  49.   end;
  50. end;
  51.  
  52. { This method shows the Series editor }
  53. Procedure EditOneSeries(AOwner:TControl; ASeries:TChartSeries);
  54. var tmpClass:TFormClass;
  55.     tmp:TForm;
  56. begin
  57.   tmpClass:=TFormClass(GetClass(ASeries.GetEditorClass));
  58.   if Assigned(tmpClass) then
  59.   begin
  60.     tmp:=tmpClass.Create(AOwner);
  61.     With tmp do
  62.     try
  63.       Position:=poScreenCenter;
  64.       BorderStyle:=bsDialog;
  65.       BorderIcons:=[biSystemMenu];
  66.       Scaled:=False;
  67.       Caption:=Format(TeeMsg_Editing,[ASeries.Name]);
  68.       Tag:=Longint(ASeries);
  69.       Height:=Height+GetSystemMetrics(SM_CYDLGFRAME)+GetSystemMetrics(SM_CYCAPTION);
  70.       ShowModal;
  71.     finally
  72.       Free;
  73.     end;
  74.   end
  75.   else raise Exception.CreateFmt(TeeMsg_CannotFindEditor,[ASeries.GetEditorClass]);
  76. end;
  77.  
  78. end.
  79.